#include "Automat.h"
#include "../Symboltable/HashTable.h"
#include "IScanner.h"
#include "State.h"

Automat::Automat(IScanner* newScanner) :
	scanner(newScanner), currentState(StateStart::makeState()) {
	assert(newScanner != NULL);
}

TokenType Automat::handle(char c) {
	return currentState->operation(c, this);
}

void Automat::setCurrentState(IState* newState) {
	currentState = newState;
}

int Automat::ungetChar(size_t count) {
	assert(scanner && "ungetChar - scanner is NULL");
	return scanner->ungetChar(count);
}

void Automat::error() {
	// not used
}
